import Dialog from '../../miniprogram_npm/@vant/weapp/dialog/dialog';
import Toast from '../../miniprogram_npm/@vant/weapp/toast/toast';
import { orderDateils, cancelOrders, deleteOrders } from "../../utils/api";
Page({
  data: {
    renderObj: {}
  },
  onLoad(e: any) {
    this.getOrderDateils(e.id);
  },
  // 获取时分
  getHM(ms: number) {
    let h = Math.floor(ms / 1000 / 60 / 60) > 9 ? Math.floor(ms / 1000 / 60 / 60) : '0' + Math.floor(ms / 1000 / 60 / 60);
    let m = Math.floor(ms / 1000 / 60 % 60) > 9 ? Math.floor(ms / 1000 / 60 % 60) : '0' + Math.floor(ms / 1000 / 60 % 60);
    return `${h}小时${m}分`;
  },
  async getOrderDateils(id: any) {
    const { data } = await orderDateils({ orderID: id })
    if (data['appointmentTime']) {
      data['appointmentTime'] = ((+data['appointmentTime']) - +new Date());
    }
    this.setData({
      renderObj: data
    })
    console.log(data);
  }
})